package com.lmk.mkcc.feign;

import com.lmk.mkcc.domain.Login;
import com.lmk.mkcc.enums.GlobalErrorCode;
import com.lmk.mkcc.result.JSONResult;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

@Component
public class LoginServiceFallbackFactory implements FallbackFactory<LoginService> {
    @Override
    public LoginService create(Throwable throwable) {
        throwable.printStackTrace();
        return new LoginService() {
            @Override
            public JSONResult saveOrUpdate(Login login) {
                return JSONResult.error(GlobalErrorCode.FUSE_ERROR);
            }
        };
    }
}
